<template>
	<view class="nav">
		<view class="header">
			<view class="left overflow-hidden">
				<view class="d-flex align-items-center overflow-hidden" @tap="goAddress">
					<image src='/static/images/order/location.png' style="width: 30rpx; height: 30rpx;" class="mr-10">
					</image>
					<view class="font-size-extra-lg text-color-base font-weight-bold text-truncate">
						{{ address.street || '请填写配送地址' }}
					</view>
					<view class="iconfont iconarrow-right" style="margin-top: 10rpx;"></view>
				</view>
				<view class="font-size-sm text-color-assist overflow-hidden text-truncate">
					由<text class="text-color-base" style="margin: 0 10rpx">{{ store.name }}</text>配送
				</view>
			</view>

			<slot></slot>

			<view class="right">
				<view class="takeout active">
					<text>配送</text>
				</view>
			</view>
		</view>
		<view class="coupon">
			<image class="title-icon" src="/static/images/index/mcsb.png" mode=""></image>
			<text class="title">当天18:00前下单, 次日9:00开始配送, 赶紧选购吧!!</text>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
	} from 'vuex'
	export default {
		computed: {
			...mapState(['address', 'store']),
		},
		methods: {
			// 去填写地址
			goAddress() {
				uni.navigateTo({
					url: '/packagesA/address/address?is_choose=true'
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.nav {
		width: 100%;
		height: 212rpx;
		flex-shrink: 0;
		display: flex;
		flex-direction: column;

		.header {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx;
			background-color: #ffffff;
			height: 140rpx;

			.left {
				flex: 1;
				display: flex;
				flex-direction: column;

				.store-name {
					display: flex;
					justify-content: flex-start;
					align-items: center;
					font-size: $font-size-lg;
					margin-bottom: 10rpx;

					.iconfont {
						margin-left: 10rpx;
						line-height: 100%;
					}
				}

				.store-location {
					display: flex;
					justify-content: flex-start;
					align-items: center;
					color: $text-color-assist;
					font-size: $font-size-sm;

					.iconfont {
						vertical-align: middle;
						display: table-cell;
						color: $color-primary;
						line-height: 100%;
					}
				}
			}

			.right {
				background-color: $bg-color-grey;
				border-radius: 38rpx;
				display: flex;
				align-items: center;
				font-size: $font-size-sm;
				// padding: 0 38rpx;
				color: $text-color-assist;

				.dinein,
				.takeout {
					position: relative;
					display: flex;
					align-items: center;

					&.active {
						padding: 14rpx 38rpx;
						color: #ffffff;
						background-color: $color-primary;
						border-radius: 38rpx;
					}
				}

				.takeout {
					// margin-left: 20rpx;
					height: 100%;
					flex: 1;
					padding: 14rpx 0;
				}

				// .dinein.active {
				// 	margin-left: -38rpx;
				// }

				// .takeout.active {
				// 	margin-right: -38rpx;
				// }
			}
		}

		.coupon {
			flex: 1;
			width: 100%;
			background-color: $bg-color-primary;
			font-size: $font-size-base;
			color: $color-primary;
			padding: 0 20rpx;
			display: flex;
			align-items: center;
			overflow: hidden;

			.title-icon {
				width: 32rpx;
				height: 32rpx;
			}

			.title {
				flex: 1;
				margin-left: 10rpx;
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}

			.iconfont {
				line-height: 100%;
			}
		}
	}
</style>